#include "XmlFactoryImpl.h"
#include "LibXml2XmlImpl.h"

XML_TOOL_NAMESPACE_BEGIN

LibXml2XmlFactory::LibXml2XmlFactory(void)
{
	LIBXML_TEST_VERSION;
}

LibXml2XmlFactory::~LibXml2XmlFactory(void)
{
	xmlCleanupParser();
	xmlMemoryDump();
}

XmlDocumentPtr LibXml2XmlFactory::CreateXmlDocument()
{
	return LibXml2XmlDocument::CreateDocument();
}

XmlDocumentPtr LibXml2XmlFactory::CreateXmlDocument(const string& xmlText, const string& encoding)
{
	return LibXml2XmlDocument::CreateDocument(xmlText, encoding);
}

void LibXml2XmlFactory::ReleaseXmlDocument(XmlDocumentPtr xmlDoc)
{
	delete xmlDoc;
}

XmlFactory* XmlFactory::GetXmlFactory()
{
	static LibXml2XmlFactory xmlFactory;
	return &xmlFactory;
}

XML_TOOL_NAMESPACE_END